package cn.yyh.serviceOrg.controller;

import cn.yyh.commons.exception.MyException;
import cn.yyh.commons.utils.R;
import cn.yyh.serviceOrg.service.IVerifyCodeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @author 杨永航
 * @version 1.0
 * @Title: VerifyCodeController
 * @Package: cn.yyh.user.controller
 * @date 2021/6/30
 */
@RestController
@RequestMapping("/serviceOrg/verifyCode")
public class VerifyCodeController {
    @Autowired
    private IVerifyCodeService verifyCode;

    @PostMapping("smsCode")
    public R smsCode(@RequestBody Map<String, Object> map) {
        try {
            verifyCode.smsCode(map);
            return R.oK();
        } catch (MyException e) {
            e.printStackTrace();
            return R.error().message(e.getMessage()).code(20000);
        } catch (Exception e) {
            e.printStackTrace();
            return R.error().code(20000);
        }
    }
}
